<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品详情</title>
    <script src = "<?php echo (JS_URL); ?>jquery-2.2.3.min.js"></script>
    <script src = "<?php echo (JS_URL); ?>bootstrap.js"></script>
    <link rel="stylesheet" href="<?php echo (CSS_URL); ?>single.css" type="text/css">
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <!-- FlexSlider -->
    <script defer src="<?php echo (JS_URL); ?>jquery.flexslider.js"></script>
    <link rel="stylesheet" href="<?php echo (CSS_URL); ?>flexslider.css" type="text/css" media="screen" />
</head>
<body leftmargin="0" topmargin="0" rightmargin = "0">
<iframe class = "singlehead" src = "/honeystore/index.php/Home/Index/indexHead" scrolling="no"></iframe>
<div class="navbar navbar-default shadow" role="navigation">
    <div class = "container">
        <ul class="nav navbar-nav">
            <li><a href="/honeystore/index.php/Home/Index/index">主页</a></li>
            <li class="dropdown">
                <a href="/honeystore/index.php/Home/Goods/product" data-toggle="dropdown" class="dropdown-toggle">全部分类<span class="caret"></span></a>
                <ul class="dropdown-menu">
                    <li><a href="/honeystore/index.php/Home/Goods/product">全部分类</a></li>
                    <li><a href="/honeystore/index.php/Home/Goods/product?type=classify&keyWord=蜂蜜">蜂蜜</a></li>
                    <li><a href="/honeystore/index.php/Home/Goods/product?type=classify&keyWord=蜂胶">蜂胶</a></li>
                    <li><a href="/honeystore/index.php/Home/Goods/product?type=classify&keyWord=花粉">花粉</a></li>
                    <li><a href="/honeystore/index.php/Home/Goods/product?type=classify&keyWord=蜂皇浆">蜂皇浆</a></li>
                </ul>
            </li>
            <li><a href="http://www.360doc.com/content/14/1113/19/16901590_424885250.shtml" target="_blank">蜂蜜养生</a></li>
            <li><a href="##">加盟我们</a></li>
            <li><a href="##">关于三生锁</a></li>
        </ul>
        <form action="/honeystore/index.php/Home/Goods/product" class="navbar-form navbar-right" rol="search">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="请输入关键词" />
            </div>
            <button type="submit" class="btn btn-default">搜索</button>
        </form>
    </div>
</div>
<?php if(is_array($pro_info)): $i = 0; $__LIST__ = $pro_info;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$info): $mod = ($i % 2 );++$i;?><!--商品图片美术馆-->
<div class="single">
    <div class="container">
        <div class = "single-img col-xs-4 clearfix">
            <div class="flexslider details-lft-inf">
                <ul class="slides">
                    <li data-thumb="<?php echo ($info["img2"]); ?>">
                        <img src="<?php echo ($info["img2"]); ?>" />
                    </li>
                    <li data-thumb="<?php echo ($info["img3"]); ?>">
                        <img src="<?php echo ($info["img3"]); ?>" />
                    </li>
                    <li data-thumb="<?php echo ($info["img4"]); ?>">
                        <img src="<?php echo ($info["img4"]); ?>" />
                    </li>
                    <li data-thumb="<?php echo ($info["img5"]); ?>">
                        <img src="<?php echo ($info["img5"]); ?>" />
                    </li>
                </ul>
            </div>
        </div>
        <div class = "single-form col-xs-7">
           <form id="form"><!--订单信息表单action = "addShoppingCar"-->
               <input type="hidden" name = "p_id" id="p_id"  value="<?php echo ($info["p_id"]); ?>">
               <input type="hidden" name = "u_id" id="u_id" value="<?php echo (session('u_id')); ?>">
                <div class = "item"> <!--商品名称-->
                    <span id = "pro_name" class = "pro_name">纯天然 【<span id = "cg"><?php echo ($info["cg_id"]); ?></span>】<?php echo ($info["p_name"]); ?></span>
                </div>
                <div class = "item"> <!--商品描述-->
                    <span id = "pro_detail" class = "pro_detail">本店热销产品</span>
                </div>
                <div class = price_panel>
                    <div class = "item"> <!--商品价格-->
                        <span class = "item_info">价格</span><span id = "pro_price" class = "pro_price"><?php echo ($info["price"]); ?></span><span class = "item_info">/<?php echo ($info["weight"]); ?>g</span>
                    </div>
                    <div class = "item"> <!--活动-->
                        <span class = "item_info">活动</span><span class = "discount">全场9折</span>
                    </div>
                </div>
                <div class = "item"> <!--购买数量，库存-->
                    <span class = "item_info">数量</span><input min="1" type="number" id="quantity" name="count" value="1" class="form-control input_number">
                    <span class = "item_info2">库存<span id = "inventory">1026</span>件</span>
                </div>
                <div class = "item"> <!--运费-->
                    <span class = "item_info">运费</span>
                    <span class = "carriage" name = "carriage">10元</span><span class = "">(全国统一运费)</span>
                </div>
                <div>
                    <span class = "item_info"></span>
                    <button id="submit" class = "btn submit_button"><span class = "glyphicon glyphicon-shopping-cart ">加入购物车</span></button>
                </div>
           </form>
            <div class = "icon_panel">
                <div class = "icon_guarantee">
                    <span class = "icon_guarantee1"></span><span class = "icon_info">100%正品保证</span>
                </div>
                <div class = "icon_guarantee">
                    <span class = "icon_guarantee2"></span><span class = "icon_info">7天无理由退货</span>
                </div>
                <div class = "icon_guarantee">
                    <span class = "icon_guarantee3"></span><span class = "icon_info">退货返运费</span>
                </div>
            </div>
            <div class = "favor">
                <a href="#" id = "favor"><span class = "glyphicon glyphicon-star">加入收藏夹</span></a>
            </div>
        </div>
    </div>
</div>
<!--商品介绍栏-->
<div class = "pro_intradution">
    <div class ="container">
        <div class = "panel-group" id = "accordion">
            <div class = "panel panel-accordion panel-default ">
                <div class = "panel-heading shadow">
                    <h4 class = "panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse1">商品信息</a></h4>
                </div>
                <div id="collapse1" class = "panel-collapse collapse in">
                    <div class = "panel-body">
                        <div class="Info_item">产品名称：<span class = "Info_msg">【<?php echo ($info["cg_name"]); ?>】牌<?php echo ($info["cg_name"]); echo ($info["p_name"]); ?></span></div>
                        <div class = "Info_item">产品重量:<?php echo ($info["weight"]); ?>g</div>
                        <div class = "Info_item">品牌: <span class = "Info_msg"><?php echo ($info["cg_name"]); ?></span></div>
                        <div class = "Info_item">是否礼盒装: 否</div>
                        <div class = "Info_item">是否进口: 否</div>
                        <div class = "Info_item">食用方法和食用量:早晚各1次</div>
                        <div class = "Info_item">注意事项:蜂产品过敏者慎用,本品不能代替药物；</div>
                        <div class = "Info_item">功能:增强免疫力</div>
                        <div class = "Info_item">适宜人群:免疫力低下者</div>
                        <div class = "Info_item">贮藏方法:置阴凉干燥处</div>
                    </div>
                </div>
            </div>
            <div class = "panel panel-accordion panel-default">
                <div class = "panel-heading shadow">
                    <h4 class = "panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse2">商品图片</a></h4>
                </div>
                <div id="collapse2" class = "panel-collapse collapse">
                    <div class = "panel-body panel_img">
                        <img src="<?php echo ($info["cg_img1"]); ?>">
                        <img src="<?php echo ($info["cg_img2"]); ?>">
                        <img src="<?php echo ($info["cg_img3"]); ?>">
                        <img src="<?php echo ($info["cg_img4"]); ?>">
                        <img src="<?php echo ($info["cg_img5"]); ?>">
                    </div>
                </div>
            </div>
            <div class = "panel panel-accordion panel-default">
                <div class = "panel-heading shadow">
                    <h4 class = "panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse3">顾客回馈</a></h4>
                </div>
                <div id="collapse3" class = "panel-collapse collapse">
                    <div class = "panel-body">
                        评论区尚在施工哦！
                    </div>
                </div>
            </div>
        </div>
    </div>
</div><?php endforeach; endif; else: echo "" ;endif; ?>
<!--底部信息栏-->
<div class = "footer">
    <div class = "container">
        <div class="col-sm-3 footer-grid">
            <h2>购物指南</h2>
            <ul>
                <li><a href="#">导购演示</a></li>
                <li><a href="#">订单操作</a></li>
                <li><a href="#">会员注册</a></li>
                <li><a href="#">账户管理</a></li>
            </ul>
        </div>
        <div class="col-sm-3 footer-grid">
            <h2>服务保障</h2>
            <ul>
                <li><a href="#">正品保证</a></li>
                <li><a href="#">7天无理由放心退</a></li>
                <li><a href="#">退货返运费</a></li>
                <li><a href="#">7*15小时客户服务</a></li>
            </ul>
        </div>
        <div class="col-sm-3 footer-grid">
            <h2>支付方式</h2>
            <ul>
                <li><a href="#">支付宝支付</a></li>
                <li><a href="#">快捷支付</a></li>
                <li><a href="#">微信支付</a></li>
                <li><a href="#">翼支付</a></li>
            </ul>
        </div>
        <div class="col-sm-3 footer-grid">
            <h2>配送方式</h2>
            <ul>
                <li><a href="#">全场满￥120包邮</a></li>
                <li><a href="#">配送范围及运费</a></li>
                <li><a href="#">验货与签收</a></li>
                <li><a href="#">合作物流品牌</a></li>
            </ul>
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="footer-copy">
        <div class = "container">
            <p>Copyright &copy; 1996-2016.SanShengSuo All rights reserved 湘ICP备08114786号 ICP经营许可证：湘B2-20080329 网络文化经营许可证：湘网文〔2015〕1528-229
                使用本网站即表示接受<a href = "#">三生锁用户协议</a>。版权所有 <a href="#">湖南三生锁蜂蜜连锁有限公司</a></p>
        </div>
    </div>
</div>
</body>
</html>
<script>
    // Can also be used with $(document).ready()
    $(window).load(function() {
        $('.flexslider').flexslider({
            animation: "slide",
            controlNav: "thumbnails"
        });
        if($('#cg').text() == 1){
            $('#cg').text("百花");
        }
        else if($('#cg').text() == 2){
            $('#cg').text("蜂蜜堂");
        }
        else if($('#cg').text() == 3){
            $('#cg').text("冠生园");
        }

        $('#submit').click(function(){
            $.ajax({
                url:"/honeystore/index.php/Home/Goods/addShoppingCar/",
                type:"POST",
                data:$('#form').serialize(),
                success: function(data) {
                    $('#submit').html(data);
                    if(data == "添加成功") {
                        var amount = parseInt($("iframe").contents().find("#cart-amount").text()) + 1;
                        $("iframe").contents().find("#cart-amount").text(amount);
                    }
                },
                error:function(){
                    alert("请求失败");
                }
            });
            return false;
        });

        $('#favor').click(function(){
            $.ajax({
                url:"/honeystore/index.php/Home/Goods/favor",
                type:"POST",
                data: {
                    "p_id": $('#p_id').val(),
                    "u_id": $('#u_id').val(),
                    "type": "add"
                },
                success: function(data) {
                    $('#favor').html(data);
                },
                error:function(){
                    alert("请求失败");
                }
            });
        });
    });
    
</script>